<?php if ( ! defined('BASEPATH')) exit('No direct script schess allowed'); ?>

<?=form_hidden("ID", $this->input->post("ID"))?>
<?=form_hidden("ENTITY", $this->input->post("ENTITY"))?>

<? //common::pr($getUser); ?>

<div class="form-group">
	<?=form_label($this->lang->line("GROUP"), "u2g_grp_id", array("class" => "control-label"))?>
	<?=form_dropdown("u2g_grp_id", $getGroupList, (isset($getUser[$this->input->post("ID")]) ? key($getUser[$this->input->post("ID")]["grpName"]) : null), "id=\"u2g_grp_id\" style=\"width: 100%;\"")?>
	<script>
		$(function() {
			$('#u2g_grp_id').select2();
		});
	</script>
</div>

<div class="form-group">
	<?=form_label($this->lang->line("E-MAIL_ADDRESS"), "usr_email", array("class" => "control-label"))?>
	<?=form_input("usr_email", (isset($getUser[$this->input->post("ID")]["usrEmail"]) ? $getUser[$this->input->post("ID")]["usrEmail"] : null), "placeholder=\"".$this->lang->line("E-MAIL_ADDRESS")."\" class=\"form-control\" id=\"usr_email\"")?>
</div>

<div class="form-group">
	<?=form_label($this->lang->line("PASSWORD"), "usr_password", array("class" => "control-label"))?>
	<?=form_password("usr_password", null, "placeholder=\"".$this->lang->line("PASSWORD")."\" class=\"form-control\" style=\"margin-bottom: 2px;\" id=\"usr_password\"")?>
	<script>
		$(function() {
			$('#usr_password').pwstrength({
				ui: {
					showVerdictsInsideProgressBar: true
				}
			});
		});
	</script>
</div>

<div class="form-group">
	<?=form_label($this->lang->line("RE-TYPE_PASSWORD"), "usr_password_re", array("class" => "control-label"))?>
	<?=form_password("usr_password_re", null, "placeholder=\"".$this->lang->line("RE-TYPE_PASSWORD")."\" class=\"form-control\" id=\"usr_password_re\"")?>
</div>

<h4><?=$this->lang->line("CONNECT_USER")?></h4>

<br/><div class="alert alert-info alert-dismissable">
	<i class="fa fa-info"></i>
	<button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
	<?=$this->lang->line("BY_CONNECTING_USER_AND_DATA_TYPE,_THE_USER_CAN_EDIT_THAT_DATA")?>
</div>

<? if(!Common::isAdmin()) { ?>

	<div class="form-group">
		<?=form_label($this->lang->line("ORSZAGHOZ"), "cou_id", array("class" => "control-label"))?>
		<?=form_dropdown("cou_id[]", $getCountryList, (isset($getUser[$this->input->post("ID")]["couList"]) ? explode(",", $getUser[$this->input->post("ID")]["couList"]) : null), "id=\"cou_id\" style=\"width: 100%;\" multiple")?>
		<script>
			$(function() {
				$('#cou_id').select2({
					placeholder: '<?=$this->lang->line("ORSZAGHOZ")?>',
				});
			});
		</script>
	</div>

	<div class="form-group">
		<?=form_label($this->lang->line("FOR_CITY"), "city_id", array("class" => "control-label"))?>
		<?=form_input("city_id[]", (isset($getUser[$this->input->post("ID")]["cityList"]) ? $getUser[$this->input->post("ID")]["cityList"] : null), "style=\"width:100%;\" id=\"city_id\"")?>
		<script>
			$(function() {
				$('#city_id').select2({
					allowClear: true,
					multiple: true,
					placeholder: '<?=$this->lang->line("FOR_CITY")?>',
					minimumInputLength: 2,
					ajax: {
						url: '<?=site_url("admin_lte/get_city")?>',
						cache: false,
						dataType: 'json',
						data: function (term, page) {
							return {
								q: term
							};
						},
						results: function (data, page) {
							return {results: data, more: false};
						}
					},
					initSelection: function(element, callback) {
						var id=$(element).val();
						if (id!=="") {
							$.ajax('<?=site_url("admin_lte/get_city")?>', {
								data: {
									id: id
								},
								cache: false,
								dataType: "json"
							}).done(function(data) { callback(data); });
						}
					},
					formatSelection: function(a, b, c) {
						if($.isArray(a)) {
							return a[0].text;
						}
						return a.text;
					},
					escapeMarkup: function (m) { return m; }
				});
			});
		</script>
	</div>

<? } ?>

<div class="form-group">
	<?=form_label($this->lang->line("TO_THE_INSTITUTE"), "ins_id", array("class" => "control-label"))?>
	<?=form_dropdown("ins_id[]", $getInstituteList, (isset($getUser[$this->input->post("ID")]["insList"]) ? $getUser[$this->input->post("ID")]["insList"] : null), "id=\"ins_id\" style=\"width: 100%;\" multiple")?>
	<script>
		$(function() {
			$('#ins_id').select2({
				placeholder: '<?=$this->lang->line("TO_THE_INSTITUTE")?>',
			});
		});
	</script>
</div>

<?=Common::generateForm($getCategoryVal)?>